#!/bin/bash

amixer -c jetsonxaviernxa cset name="ADMAIF1 Mux" "I2S3"

#To enable capture from PORT 1L
amixer -c jetsonxaviernxa cset name="x RECMIX1L BST1 Switch" "on"

#Volume control for PORT 1L
amixer -c jetsonxaviernxa cset name="x IN1 Boost Volume" 40

#To enable capture from PORT 1R
amixer -c jetsonxaviernxa cset name="x RECMIX1R BST2 Switch" "on"

#Volume control for PORT 1R
amixer -c jetsonxaviernxa cset name="x IN2 Boost Volume" 40

amixer -c jetsonxaviernxa cset name="x Stereo1 ADC Source" "ADC1"
amixer -c jetsonxaviernxa cset name="x Stereo1 ADC1 Source" "ADC"
amixer -c jetsonxaviernxa cset name="x Stereo1 ADC MIXL ADC1 Switch" "on"
amixer -c jetsonxaviernxa cset name="x Stereo1 ADC MIXR ADC1 Switch" "on"
amixer -c jetsonxaviernxa cset name="x TDM Data Mux" "AD1:AD2:DAC:NUL"

#Start record
arecord -Dhw:jetsonxaviernxa,0 -c 2 -r 48000 -f S16_LE -d 15 rec.wav

aplay -D hw:jetsonxaviernxa,1 rec.wav
